// 改造之后的app-是一个类组件
import React, { Component } from 'react'
import { NavLink, Link, withRouter } from 'react-router-dom';
// import logo from './logo.svg';
import './App.css';
// import ComA from './components/ComA';
// import ComBig from './components/ComBig';
// import Fome from './components/Fome';
// import Fetch from './components/Fetch';
import {Button} from 'antd'

// 引入路由组件
import Router from './route/Index'

class App1 extends Component {
  constructor() {
    super();
    this.state = {}
  }
  changePage(url) {
    console.log(this.props.history);
    this.props.history.push(url)
  }
  render() {
    return (
      <div className="App">
        <header className="App-header">
          {/* <ComA></ComA> */}
          {/* <ComBig></ComBig> */}
          {/* <Fome></Fome> */}
          {/* <Fetch></Fetch> */}
          <Router></Router>
          {/* <NavLink to="/">返回首页</NavLink>
        <NavLink to="/404" activeClassName='active'>404页</NavLink>
        <NavLink to="/coma" activeClassName='active'>ComA页</NavLink>
        <NavLink to="/combig" activeClassName='active'>ComBig页</NavLink> */}
          <button onClick={() => this.changePage('/')}>返回首页-app</button>
          <button onClick={() => this.changePage('/404')}>404页-app</button>
          <button onClick={() => this.changePage('/coma')}>ComA页-app</button>
          <button onClick={() => this.changePage('/combig')}>ComBig页-app</button>
          <Button type="primary">Button</Button>
        </header>
      </div>
    )
  }
}

// withRouter 是一个高阶组件（HOC-higherOrderComponent）。他是一个函数，参数是原来的组件，返回值是加工强化后的组件
const App = withRouter(App1);

export default App

